using Microsoft.AspNetCore.Builder;

namespace Terra.Service.Common.Infrastructure.ExceptionHandling;

/// <summary>
/// 异常处理中间件扩展方法
/// </summary>
public static class ExceptionHandlingExtensions
{
    /// <summary>
    /// 使用全局异常处理中间件
    /// </summary>
    /// <param name="app">应用程序构建器</param>
    /// <returns>应用程序构建器</returns>
    public static IApplicationBuilder UseGlobalExceptionHandling(this IApplicationBuilder app)
    {
        return app.UseMiddleware<GlobalExceptionMiddleware>();
    }
}